﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using System.ComponentModel;
using System.Runtime.Serialization;


namespace XMas
{
#if XBOX360
    public class CategoryAttribute: Attribute
    {
        public CategoryAttribute(string category) : base() 
        {
        }
    }

    public class DescriptionAttribute: Attribute
    {
        public DescriptionAttribute(string description) : base() 
        {
        }
    }
    
    public class BrowsableAttribute : Attribute
    {
        public BrowsableAttribute(bool browsable) : base()
        {
        }
    }

    public class TypeConverterAttribute : Attribute
    {
        public TypeConverterAttribute(Type type) : base()
        {
        }
    }

    public class AnimationNameConverter
    {
        public AnimationNameConverter()
        {
        }
    }
    
#else
    /// <summary>
    /// Class to get all animations and set a combobox in property editor
    /// </summary>
    public class AnimationNameConverter : StringConverter
    {
        /// <summary>
        /// Only values in list are allowed
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
        {
            return true;
        }

        /// <summary>
        /// Set the name list
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            AnimNode_Animation Node = context.Instance as AnimNode_Animation;
            if (Node != null && Node.SkeletonData != null)
                return new StandardValuesCollection(Node.SkeletonData.list_animations.Keys);
            else
                return new StandardValuesCollection(new string[] { "" });
        }

        /// <summary>
        /// Only values in list are allowed 
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
        {
            return true;
        }
    }
#endif

}